package com.mezz.bones.im.logic.process.interfaces;


import com.mezz.bones.framework.core.strategy.IStrategy;
import com.mezz.bones.im.common.message.base.MessageHeader;
import com.mezz.bones.im.common.domain.user.ImUserConnectInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service
public interface
MessageLogicProcess<Req,Res> extends IStrategy {

    Logger log = LoggerFactory.getLogger(MessageLogicProcess.class);

    Res handler(ImUserConnectInfo senderUserConnectInfo, MessageHeader header, Object body);

    /**
     * 执行相对应的业务
     *
     * @param senderUserConnectInfo 消息发送者的客户端连接对象
     * @param header
     * @param req                   请求体数据
     * @param ctx
     */
    Res process(ImUserConnectInfo senderUserConnectInfo, MessageHeader header, Req req, Map<String, Object> ctx);

    void ack(ImUserConnectInfo senderUserConnectInfo, MessageHeader header, Res res);

    void checkParam(Req finalBody);


    Req convert2T(Object body);
}
